<html>
    <head>
        <meta charset="UTF-8" />
        <title>{:cmf_get_site_info()['site_name']} {:lang('ADMIN_CENTER')}</title>
        <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta name="robots" content="noindex,nofollow">
        <!-- HTML5 shim for IE8 support of HTML5 elements -->
        <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->
        <link href="__ADMIN_TMPL__/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" rel="stylesheet">
        <link href="__STATIC__/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <link href="__ADMIN_TMPL__/public/assets/themes/{:cmf_get_admin_style()}/login.css" rel="stylesheet">
        <!-- ********************** 特效 START ********************** -->
        <link rel="stylesheet" href="__PLUGIN_TMPL__/public/assets/css/style.css">
        <!-- **********************  特效 END  ********************** -->

        <script>
            if (window.parent !== window.self) {
                document.write = '';
                window.parent.location.href = window.self.location.href;
                setTimeout(function() {
                    document.body.innerHTML = '';
                }, 0);
            }
        </script>

        <include file="public@init" />
    </head>
    <body>
        <!-- ********************** 特效 START ********************** -->
        <canvas></canvas>
        <!-- **********************  特效 END  ********************** -->
        <div class="wrap">
            <div class="container">
                <div class="row">
                    <div class="col-md-4 col-md-offset-4">
                        <h1 class="text-center">{$title|default=''}</h1>
                        <form class="js-ajax-form" action="{:cmf_plugin_url('DferThinkcmfTools://AdminLogin/doLogin')}"
                            method="post">
                            <div class="form-group">
                                <input type="text" id="input_username" class="form-control" name="username"
                                    placeholder="{:lang('USERNAME_OR_EMAIL')}" title="{:lang('USERNAME_OR_EMAIL')}"
                                    value="{:cookie('admin_username')}" data-rule-required="true" data-msg-required="">
                            </div>
                            <div class="form-group">
                                <input type="password" id="input_password" class="form-control" name="password"
                                    placeholder="{:lang('PASSWORD')}" title="{:lang('PASSWORD')}"
                                    data-rule-required="true" data-msg-required="">
                            </div>
                            <div class="form-group">
                                <div id="captcha" style="position: relative;"></div>
                            </div>
                            <div class="form-group">
                                <input type="hidden" name="redirect" value="">
                                <button class="btn btn-primary btn-block js-ajax-submit" type="submit"
                                    style="margin-left: 0px" data-loadingmsg="{:lang('LOADING')}"
                                    data-success_refresh="successRefreshCallback">
                                    {:lang('LOGIN')}
                                </button>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
        <script type="text/javascript">
            //全局变量
            var GV = {
                ROOT: "__ROOT__/",
                WEB_ROOT: "__WEB_ROOT__/",
                JS_ROOT: "static/js/",
                APP: '' /*当前应用名*/
            };
        </script>
        <script src="__STATIC__/js/jquery.js"></script>
        <script src="__STATIC__/js/wind.js"></script>
        <script src="__PLUGIN_TMPL__/public/assets/js/gt.js"></script>
        <script>
            var ajaxUrl = '{:cmf_plugin_url("DferThinkcmfTools://AdminLogin/startCaptcha")}';
            var not_verify = '{:lang("PLEASE_VERIFY")}';
            var verify_wrong = '{:lang("CAPTCHA_NOT_RIGHT")}';
            var validate_result = false;



            ////////////////////////////////////////////////// 验证 START //////////////////////////////////////////////////            

            function geetestInit() {
                document.getElementById('input_username').focus();
                //极验插件初始化
                $.ajax({
                    url: ajaxUrl,
                    type: "get",
                    dataType: "json",
                    cache: false,
                    success: function(data) {
                        console.log(data);
                        initGeetest({
                            gt: data.gt,
                            challenge: data.challenge,
                            new_captcha: data.new_captcha,
                            product: "embed",
                            width: '100%',
                            offline: !data.success
                        }, function(captchaObj) {
                            captchaObj.appendTo("#captcha");
                            // formInit(captchaObj);
                        });
                    }
                });

            }

            function successRefreshCallback(data, statusText, xhr, $form) {
                localStorage.setItem('token', data.data.token);
                // console.log(data);return;
                if (data.url) {
                    //返回带跳转地址
                    window.location.href = data.url;
                }
            }

            geetestInit();

            //////////////////////////////////////////////////  验证 END  //////////////////////////////////////////////////
        </script>
        <script src="__STATIC__/js/admin.js?v={$_static_version}"></script>

        <!-- ********************** 特效 START ********************** -->
        <script src='__PLUGIN_TMPL__/public/assets/js/zrveeq.js'></script>
        <script src="__PLUGIN_TMPL__/public/assets/js/index.js"></script>
        <!-- **********************  特效 END  ********************** -->

    </body>
</html>